﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using WQLWebAPI.Infrastructure.Extensions;
using WQLWebAPI.Domain.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;

using WQLWebAPI.Infrastructure.CommonDtos;
using System.Text;
using Microsoft.Extensions.Configuration;
using WQLWebAPI.Application.Images;
using WQLWebAPI.Application.Loggers;
using WQLWebAPI.Api.Filters;
using WQLWebAPI.Api.Models;

namespace WQLWebAPI.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InstrumentController : ControllerBase
    {
        private readonly ILogService _logService;
        private readonly IConfiguration _config;

        public InstrumentController(ILogService logService, IConfiguration config)
        {
            _logService = logService;
            _config =config;
            
        }

        /// <summary>
        /// 读取异常日志
        /// </summary>
        /// <returns></returns>
        [Route("GetErrorLog")]
        [HttpGet]
        [PermissionAuthorzize(Area = AuthorizeClaims.日志, Permission = AuthorizeClaims.读取)]
        //[Logger(Operation = "读取异常日志")]
        public async Task<ActionResult<Pagelist<ErrorLog>>> GetErrorLog([FromQuery] PageInputDto input)
        {
            return await _logService.GetErrorLogerAsync(input);
        }
        /// <summary>
        /// 读取操作日志
        /// </summary>
        /// <returns></returns>
        [Route("GetInfoLog")]
        [HttpGet]
        [PermissionAuthorzize(Area = AuthorizeClaims.日志, Permission = AuthorizeClaims.读取)]
        //[Logger(Operation = "读取操作日志")]
        public async Task<ActionResult<Pagelist<InfoLog>>> GetInfoLog([FromQuery] PageInputDto input)
        {
            return await _logService.GetInfoLogerAsync(input);
        }
    }

}